﻿<template>
  <div class="activity-end-page">
    <div
      v-if="pageContent.activityStatus === 1"
      class="error-page"
    >
      <div class="error-img">
        <img src="../../assets/image/error2.png" />
      </div>
      <div class="error-title">
        温馨提示
      </div>
      <div v-if="pageContent.startTime === null" class="error-start">
        活动未开始，请耐心等待
      </div>
      <div v-if="pageContent.startTime !== null" class="error-start">
        活动开始时间：{{ Number(pageContent.startTime) | date }}
      </div>
      <div class="error-desc">
        快去查看其他活动吧
      </div>
      <div class="error-btn">
        <div class="error-reload" @click="backToPage">
          返回
        </div>
      </div>
    </div>
    <div
      v-if="pageContent.activityStatus === 2"
      class="error-page"
    >
      <div class="error-img">
        <img src="../../assets/image/error2.png" />
      </div>
      <div class="error-title">
        抱歉，活动已结束
      </div>
      <div class="error-desc">
        快去查看其他活动吧
      </div>
      <div class="error-btn">
        <div class="error-reload" @click="backToPage">
          返回
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import tool from '@/util/tool'
import { mapGetters } from 'vuex'

export default {
  name: 'ActivityEnd',
  components: {
     
  },
  filters: {
    date: function (value) {
      if (!value || value === '') {
        return ''
      }
      let date = new Date(value)
      let o = {
        'M+': date.getMonth() + 1,
        'd+': date.getDate(),
        'h+': date.getHours(),
        'm+': date.getMinutes(),
        's+': date.getSeconds(),
        'q+': Math.floor((date.getMonth() + 3) / 3),
        S: date.getMilliseconds(),
      }
      let fmt = 'yyyy-MM-dd hh:mm:ss'
      if (/(y+)/.test(fmt))
        fmt = fmt.replace(
          RegExp.$1,
          (date.getFullYear() + '').substr(4 - RegExp.$1.length)
        )
      for (let k in o)
        if (new RegExp('(' + k + ')').test(fmt))
          fmt = fmt.replace(
            RegExp.$1,
            RegExp.$1.length == 1
              ? o[k]
              : ('00' + o[k]).substr(('' + o[k]).length)
          )
      return fmt
    },
  },
  props: {
  },
  data () {
    return {

    }
  },
  computed: {
    ...mapGetters('main', ['pageContent'])
  },
  mounted () {
  },
  methods:{
    backToPage () {
      tool.appBack()
    }
  }
}
</script>
<style lang="less" scoped>
 .activity-end-page{
   .error-img {
    display: flex;
    justify-content: center;
    margin-top: 109px;
  }

  .error-img img {
    width: 109px;
    height: 109px;
  }

  .error-title {
    color: #333333;
    font-size: 19px;
    display: flex;
    justify-content: center;
    margin-top: 18px;
    font-weight: 400;
  }

  .error-desc {
    color: #939499;
    font-size: 14px;
    display: flex;
    justify-content: center;
    margin-top: 15px;
    font-weight: 400;
  }

  .error-start {
    color: #333333;
    font-size: 14px;
    display: flex;
    justify-content: center;
    margin-top: 10px;
    font-weight: 400;
  }

  .error-btn {
    display: flex;
    justify-content: center;
    margin-top: 93px;
  }

  .error-reload {
    width: 250px;
    height: 45px;
    background-color: #1bb855;
    font-size: 18px;
    color: #ffffff;
    border-radius: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
  }
 }
</style>
